/**
 * DbSchema.java
 *
 * Copyright (c) 2010 Prj.Manager All Rights Reserved.
 *
 * This source file may not be copied, modified or redistributed,
 * in whole or in part, in any form or for any reason, without the express
 * written consent of Prj.Manager .
 **/

package ro.prjmanager.model;


import javax.persistence.*;

/**
 * This class from the domain model is mapping the table db_schema
 * @author Viorel Tacliciu
 * @version 2
 */

@Table(name="db_schema")
@Entity
public class  DbSchema{

    //define attributes that maps all columns of the coresponding table
    //this attribute maps the primary key column ID
    private java.lang.Integer id;
    //this attribute maps an bidirectional association
    //it means that FK_DB_SCHEMA from table project_db is a foreign key to ID
    private java.util.List<ProjectDb> fkDbSchemaProjectDb;
    //this attribute maps the foreign key column FK_SCHEMA
    private Schema fkSchema;
    //this attribute maps the foreign key column FK_DATABASE
    private DataBases fkDatabase;
    private String name;
    //end mapping columns

    //define getters and setters with coresponding ejb3 annotation, depending of the type
    //of the relation for the column

    /**
     * Mapping the primary key
     * @return - java.lang.Integer the primary key for this entity
     **/
    @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "ID")
    public  java.lang.Integer  getId(){
        return this.id;
    }

    /**
     * The setter for ID column
     * @param id -  an java.lang.Integer object
     **/
    public void setId( java.lang.Integer  id){
        this.id=id;
    }
    /**
     * This method maps an OneToMany relation between this table and
     * ProjectDb table
     * @return - an list of ProjectDb objects
     **/
    @OneToMany(cascade=CascadeType.REFRESH)
    @JoinColumn(name = "FK_DB_SCHEMA",referencedColumnName = "ID") 
    public java.util.List<ProjectDb> getFkDbSchemaProjectDb(){
        return this.fkDbSchemaProjectDb;
    }
    
    /**
     * This method sets the field fkDbSchemaProjectDb of this entity
     * @param fkDbSchemaProjectDb - an list of ProjectDb objects
     **/
    public void setFkDbSchemaProjectDb(java.util.List<ProjectDb> fkDbSchemaProjectDb){
        this.fkDbSchemaProjectDb=fkDbSchemaProjectDb;
    }
    /**
     * This method maps an ManyToOne relation between this entity and
     * schema_ entity
     * @return - an Schema object
     **/
    @ManyToOne(cascade=CascadeType.REFRESH)
    @JoinColumn(name = "FK_SCHEMA",referencedColumnName = "ID")
    public Schema getFkSchema(){
        return this.fkSchema;
    }

    /**
     * This method sets the field fkSchema of this entity
     * @param fkSchema - an Schema object
     **/
    public void setFkSchema(Schema fkSchema){
        this.fkSchema=fkSchema;
    }
    /**
     * This method maps an ManyToOne relation between this entity and
     * data_bases entity
     * @return - an DataBases object
     **/
    @ManyToOne(cascade=CascadeType.REFRESH)
    @JoinColumn(name = "FK_DATABASE",referencedColumnName = "ID")
    public DataBases getFkDatabase(){
        return this.fkDatabase;
    }

    /**
     * This method sets the field fkDatabase of this entity
     * @param fkDatabase - an DataBases object
     **/
    public void setFkDatabase(DataBases fkDatabase){
        this.fkDatabase=fkDatabase;
    }

    @Column(name = "NAME")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}



